.class public Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;
.super Ljava/lang/Object;
.source "SprayDisplayerUsingPolyline.java"


# static fields
.field private static bearingTolerance:D = 0.05


# instance fields
.field private area:D

.field private bearing:D

.field private color:I

.field private color2:I

.field private cu:Llt/noframe/gpsfarmguide/sprayer/CCalcs;

.field private currentArea:D

.field currentPoly:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Lcom/google/android/gms/maps/model/LatLng;",
            ">;"
        }
    .end annotation
.end field

.field private drawPolygon:Z

.field private lastZoom:D

.field private lastbearing:D

.field private polylines:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Lcom/google/android/gms/maps/model/PolylineOptions;",
            ">;"
        }
    .end annotation
.end field

.field private sprayWidth:D


# direct methods
.method public constructor <init>(D)V
    .locals 2

    .line 45
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 23
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->polylines:Ljava/util/List;

    const/4 v0, 0x0

    .line 24
    iput-object v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    const-wide/high16 v0, 0x4014000000000000L    # 5.0

    .line 28
    iput-wide v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->sprayWidth:D

    const v0, -0x4eff0100

    .line 34
    iput v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->color:I

    const v0, -0x4ef00100

    .line 35
    iput v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->color2:I

    const/4 v0, 0x1

    .line 40
    iput-boolean v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->drawPolygon:Z

    .line 46
    new-instance v0, Llt/noframe/gpsfarmguide/sprayer/CCalcs;

    invoke-direct {v0}, Llt/noframe/gpsfarmguide/sprayer/CCalcs;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->cu:Llt/noframe/gpsfarmguide/sprayer/CCalcs;

    const-wide/16 v0, 0x0

    .line 47
    iput-wide v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->area:D

    .line 48
    iput-wide v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentArea:D

    .line 49
    iput-wide p1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->sprayWidth:D

    const-wide/high16 p1, -0x4010000000000000L    # -1.0

    .line 50
    iput-wide p1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->lastZoom:D

    .line 51
    new-instance p1, Ljava/util/ArrayList;

    invoke-direct {p1}, Ljava/util/ArrayList;-><init>()V

    iput-object p1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->polylines:Ljava/util/List;

    return-void
.end method

.method private getDifference(DD)D
    .locals 7

    sub-double v0, p1, p3

    const-wide v2, 0x4076800000000000L    # 360.0

    const-wide/16 v4, 0x0

    cmpg-double v6, v0, v4

    if-gez v6, :cond_0

    add-double/2addr v0, v2

    :cond_0
    sub-double/2addr p3, p1

    cmpg-double p1, p3, v4

    if-gez p1, :cond_1

    add-double/2addr p3, v2

    .line 98
    :cond_1
    invoke-static {v0, v1, p3, p4}, Ljava/lang/Math;->min(DD)D

    move-result-wide p1

    return-wide p1
.end method


# virtual methods
.method public endPolyline()V
    .locals 2

    .line 88
    iget-object v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    if-eqz v0, :cond_0

    .line 89
    new-instance v0, Lcom/google/android/gms/maps/model/PolylineOptions;

    invoke-direct {v0}, Lcom/google/android/gms/maps/model/PolylineOptions;-><init>()V

    iget-object v1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    invoke-virtual {v0, v1}, Lcom/google/android/gms/maps/model/PolylineOptions;->addAll(Ljava/lang/Iterable;)Lcom/google/android/gms/maps/model/PolylineOptions;

    iget v1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->color:I

    invoke-virtual {v0, v1}, Lcom/google/android/gms/maps/model/PolylineOptions;->color(I)Lcom/google/android/gms/maps/model/PolylineOptions;

    const/4 v1, 0x2

    invoke-virtual {v0, v1}, Lcom/google/android/gms/maps/model/PolylineOptions;->jointType(I)Lcom/google/android/gms/maps/model/PolylineOptions;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Lcom/google/android/gms/maps/model/PolylineOptions;->geodesic(Z)Lcom/google/android/gms/maps/model/PolylineOptions;

    const/high16 v1, 0x40400000    # 3.0f

    invoke-virtual {v0, v1}, Lcom/google/android/gms/maps/model/PolylineOptions;->width(F)Lcom/google/android/gms/maps/model/PolylineOptions;

    .line 91
    iget-object v1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->polylines:Ljava/util/List;

    invoke-interface {v1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    :cond_0
    const/4 v0, 0x0

    .line 93
    iput-object v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    return-void
.end method

.method public getArea()D
    .locals 2

    .line 103
    iget-wide v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->area:D

    return-wide v0
.end method

.method public getPolys()Ljava/util/List;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List<",
            "Lcom/google/android/gms/maps/model/PolylineOptions;",
            ">;"
        }
    .end annotation

    .line 108
    iget-object v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->polylines:Ljava/util/List;

    return-object v0
.end method

.method public sprayPoint(Lcom/google/android/gms/maps/model/LatLng;)V
    .locals 14

    .line 57
    iget-object v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    if-nez v0, :cond_0

    .line 58
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    .line 59
    iget-object v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto/16 :goto_0

    .line 62
    :cond_0
    iget-object v1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->cu:Llt/noframe/gpsfarmguide/sprayer/CCalcs;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v2

    const/4 v3, 0x1

    sub-int/2addr v2, v3

    invoke-interface {v0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/google/android/gms/maps/model/LatLng;

    invoke-virtual {v1, v0, p1}, Llt/noframe/gpsfarmguide/sprayer/CCalcs;->lineSegmentBearing(Lcom/google/android/gms/maps/model/LatLng;Lcom/google/android/gms/maps/model/LatLng;)D

    move-result-wide v0

    iput-wide v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->bearing:D

    const/4 v0, 0x0

    .line 66
    iget-wide v1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->bearing:D

    iget-wide v4, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->lastbearing:D

    invoke-direct {p0, v1, v2, v4, v5}, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->getDifference(DD)D

    move-result-wide v1

    invoke-static {v1, v2}, Ljava/lang/Math;->abs(D)D

    move-result-wide v1

    sget-wide v4, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->bearingTolerance:D

    cmpg-double v6, v1, v4

    if-gez v6, :cond_1

    const/4 v0, 0x1

    :cond_1
    if-eqz v0, :cond_2

    .line 69
    iget-object v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v1

    sub-int/2addr v1, v3

    invoke-interface {v0, v1}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    .line 72
    :cond_2
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    .line 73
    iget-object v4, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->cu:Llt/noframe/gpsfarmguide/sprayer/CCalcs;

    iget-object v1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v2

    sub-int/2addr v2, v3

    invoke-interface {v1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    move-object v5, v1

    check-cast v5, Lcom/google/android/gms/maps/model/LatLng;

    iget-wide v6, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->bearing:D

    iget-wide v1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->sprayWidth:D

    const-wide/high16 v12, 0x4000000000000000L    # 2.0

    div-double v8, v1, v12

    const-wide v10, 0x4056800000000000L    # 90.0

    invoke-virtual/range {v4 .. v11}, Llt/noframe/gpsfarmguide/sprayer/CCalcs;->linePointByBearingAndDistance(Lcom/google/android/gms/maps/model/LatLng;DDD)Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 74
    iget-object v4, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->cu:Llt/noframe/gpsfarmguide/sprayer/CCalcs;

    iget-object v1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v2

    sub-int/2addr v2, v3

    invoke-interface {v1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    move-object v5, v1

    check-cast v5, Lcom/google/android/gms/maps/model/LatLng;

    iget-wide v6, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->bearing:D

    iget-wide v1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->sprayWidth:D

    div-double v8, v1, v12

    const-wide v10, -0x3fa9800000000000L    # -90.0

    invoke-virtual/range {v4 .. v11}, Llt/noframe/gpsfarmguide/sprayer/CCalcs;->linePointByBearingAndDistance(Lcom/google/android/gms/maps/model/LatLng;DDD)Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 76
    iget-object v2, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->cu:Llt/noframe/gpsfarmguide/sprayer/CCalcs;

    iget-wide v4, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->bearing:D

    iget-wide v6, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->sprayWidth:D

    div-double/2addr v6, v12

    const-wide v8, -0x3fa9800000000000L    # -90.0

    move-object v3, p1

    invoke-virtual/range {v2 .. v9}, Llt/noframe/gpsfarmguide/sprayer/CCalcs;->linePointByBearingAndDistance(Lcom/google/android/gms/maps/model/LatLng;DDD)Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 77
    iget-object v2, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->cu:Llt/noframe/gpsfarmguide/sprayer/CCalcs;

    iget-wide v4, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->bearing:D

    iget-wide v6, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->sprayWidth:D

    div-double/2addr v6, v12

    const-wide v8, 0x4056800000000000L    # 90.0

    invoke-virtual/range {v2 .. v9}, Llt/noframe/gpsfarmguide/sprayer/CCalcs;->linePointByBearingAndDistance(Lcom/google/android/gms/maps/model/LatLng;DDD)Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 79
    iget-object v1, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentPoly:Ljava/util/List;

    invoke-interface {v1, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 80
    invoke-static {v0}, Llt/noframe/gpsfarmguide/utils/Mathematics;->calculateArea(Ljava/util/List;)D

    move-result-wide v0

    iput-wide v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentArea:D

    .line 82
    :goto_0
    iget-wide v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->bearing:D

    iput-wide v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->lastbearing:D

    .line 83
    iget-wide v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->area:D

    iget-wide v2, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->currentArea:D

    add-double/2addr v0, v2

    iput-wide v0, p0, Llt/noframe/gpsfarmguide/sprayer/spray/SprayDisplayerUsingPolyline;->area:D

    return-void
.end method
